import router from '@/router'
import { usersStore } from "@/store/users";
router.beforeEach((to,from,next) => {
    if(to.path == '/login') {
        next()
    } else {
        const store = usersStore();
        if(!(store.userInfo && Object.keys(store.userInfo).length)) {
            store.getUserInfos().then((res:any) => {
                if(res) {
                    next()
                }
            })
        } else {
            next()
        }
    }
    
})